export default function request(url, data = {}, type = 'GET') {
  return new Promise((resolve, reject) => {
    let promise
    // 1. 执行异步ajax请求
		promise = uni.request({
			method: type,
			url: url,
			data: data
		})
    // 2. 如果成功了, 调用resolve(value)
    promise.then(response => {
      resolve(response[1].data)
      // 3. 如果失败了, 不调用reject(reason), 而是提示异常信息
    }).catch(error => {
      // reject(error)
			uni.showToast({
				title:'请求出错'+error.message
			})
    })
  })
}
